<template>
  <div>
    <h2>我是子组件</h2>

    <h2>{{ props.msg }}</h2>

    <h2>{{ count }}</h2>

    <button @click="change">修改数据</button>
  </div>
</template>
<script setup>
import { defineEmits } from 'vue'

const props = defineProps({
  msg: String,
  count: Number
})

//1.初始化emit函数，使用defineEmits(['事件名称'])
const emit = defineEmits(['changeCount', 'test'])

const change = () => {
  //2.调用emit函数
  emit('changeCount', 100)

  emit('test', '9k包住13薪')
}
</script>
<style lang="less"></style>
